<?php
/**
 * Created by PhpStorm.
 * User: tusimo
 * Date: 10/29/19
 * Time: 4:15 PM
 */

namespace Melo\Config\Lumen;

use Illuminate\Console\Command;
use Melo\Config\Container;

class ConfigCommand extends Command
{
    protected $signature = 'config:sync';

    protected $description = 'sync config from apollo';

    public function handle()
    {
        $config = Container::instance();
        $callback = null;
//        $callback = function () {
//            $this->info('restarting all pm2 job');
//            $process = new Process(['/usr/bin/pm2', 'restart', 'all']);
//            $process->run();
//
//            // executes after the command finishes
//            if (!$process->isSuccessful()) {
//                throw new ProcessFailedException($process);
//            }
//
//            echo $process->getOutput();
//            $this->info('restart success');
//        };
        $config->run($callback);
    }
}
